<template>
    <el-container>
        <el-header style="height: 80px;background-color: deepskyblue">
            <el-row>
                <el-col :span="12" style="text-align: left"><h1>后台管理</h1></el-col>
                <el-col :span="12" style="text-align: right"><el-link target="_blank" @click="logout" style="margin-top: 20px">退出登录</el-link></el-col>
            </el-row>
        </el-header>

        <el-container style="min-height: 600px;">
            <el-aside width="200px" style="border-right: deepskyblue 2px solid;">
                <el-menu :router="true">
                    <el-menu-item index="/admin">
                        <i class="el-icon-menu"></i>
                        <span slot="title">文章管理</span>
                    </el-menu-item>
                    <el-menu-item index="/admin/write">
                        <i class="el-icon-edit"></i>
                        <span slot="title">新增文章</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>

            <el-main style="line-height: 10px;">
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>

</template>

<script>
    export default {
        name: "Admin",
        methods: {
            logout(){
                this.$axios({
                    url: "/logout",
                    method: "get"
                }).then(res => {
                    console.log(res);
                    this.$store.commit("REMOVE_TOKEN");
                    this.$router.push("/index");
                });
            }
        }
    }
</script>

<style scoped>

</style>